package example_10.ListDemo;

import javax.swing.*;
import java.util.ArrayList;
import java.util.List;

public class ArrayListDemo_03 {
//    向集合中添加1-100之间的十个不重复的随机数
public static void main(String[] args) {
    List<Integer> a = new ArrayList<>();
    while (a.size()<10){
        int r = (int)(Math.random()*100+1);
        if(a.contains(r)){
            continue;
        }
        a.add(r);

    }
    System.out.println(a);

}
}
